package com.xiyu.service.vo.mailbox.mail.baseVO;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import jakarta.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import static com.xiyu.service.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
import java.time.LocalDateTime;

/**
 * 邮件 Base VO，提供给添加、修改、详细的子 VO 使用
 * 如果子 VO 存在差异的字段，请不要添加到这里，影响 Swagger 文档生成
 */
@Data
public class MailboxMailBase {

    @Schema(description = "邮箱账号ID")
    private Long accountId;

    @Schema(description = "邮件发送人地址")
    @Size(max = 255, message = "邮件发送人地址长度不能超过255")
    private String senderAddress;

    @Schema(description = "邮件发送人姓名")
    @Size(max = 255, message = "邮件发送人姓名长度不能超过255")
    private String senderName;

    @Schema(description = "邮件状态")
    @Range(max = 127, message = "邮件状态最大不能超过127")
    private Integer status;

    @Schema(description = "是否已读")
    private Boolean isRead;

    @Schema(description = "是否置顶")
    private Boolean isTop;

    @Schema(description = "主题")
    @Size(max = 1024, message = "主题长度不能超过1024")
    private String subject;

    @Schema(description = "发送时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private LocalDateTime sendTime;

    @Schema(description = "邮件大小")
    private Long size;

    @Schema(description = "邮局文件夹ID")
    private Long folderId;

    @Schema(description = "标记垃圾邮件前的文件夹")
    private Long beforeJunkFolderId;

    @Schema(description = "邮件类型")
    @Range(max = 127, message = "邮件类型最大不能超过127")
    private Integer mailType;

    @Schema(description = "邮件messageID")
    @Size(max = 255, message = "邮件messageID长度不能超过255")
    private String messageId;

    @Schema(description = "接收时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private LocalDateTime receiveTime;

    @Schema(description = "唯一码")
    @Size(max = 50, message = "唯一码长度不能超过50")
    private String uid;

    @Schema(description = "是否已收取邮件正文")
    private Boolean isReceiveContent;

    @Schema(description = "日程")
    private String calendar;

    @Schema(description = "是否有附件")
    private Boolean isAttachment;

    @Schema(description = "是否定时发送")
    private Boolean isScheduled;

    @Schema(description = "计划发送时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private LocalDateTime planSendTime;

    @Schema(description = "收件人个数")
    @Range(max = 100000000, message = "收件人个数最大不能超过100000000")
    private Integer receiverCount;

}
